package com.example.kafka.kerberos;

import org.apache.kafka.clients.producer.ProducerConfig;
import org.apache.kafka.common.serialization.ByteArraySerializer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.kafka.core.ProducerFactory;
import org.springframework.kafka.security.jaas.KafkaJaasLoginModuleInitializer;

import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

@SpringBootApplication
public class KafkaKerberosApplication {

//    @Bean
//    public KafkaJaasLoginModuleInitializer jaasConfig() throws IOException {
//        KafkaJaasLoginModuleInitializer jaasConfig = new KafkaJaasLoginModuleInitializer();
//        jaasConfig.setControlFlag(KafkaJaasLoginModuleInitializer.ControlFlag.REQUIRED);
//        Map<String, String> options = new HashMap<>();
//        options.put("useKeyTab", "true");
//        options.put("storeKey", "true");
//        options.put("keyTab", "/home/stone/stone.keytab");
//        options.put("principal", "stone/stone.analyticservice.net@ANALYTICSERVICE.NET");
//        options.put("serviceName","kafka");
//        jaasConfig.setOptions(options);
//        return jaasConfig;
//    }



    public static void main(String[] args) {
        SpringApplication.run(KafkaKerberosApplication.class, args);
    }

}
